//***************************************************************************
//*
//*	File:			DSWrapLib.h
//*	Description:	Master include file for DevStudio automation interfaces
//*					wrapper library
//*
//***************************************************************************
//*
//*	Note:			This source code is provided "as is" meaning that you may 
//*					use it at your own risk. 
//*					You are free to use it in any way you like.
//*
//***************************************************************************
//*
//*	History:		
//*
//*	-------------------------------------------------------------------------
//*	2003/07/27	|	Initial release									|	rk
//*	-------------------------------------------------------------------------
//*
//***************************************************************************

//
//-------------------------------------------------------------- PREPROCESSOR 
//

#ifndef			_DSWrapLib_H_INCLUDED
#define			_DSWrapLib_H_INCLUDED

#if				_MSC_VER > 1000
#pragma once
#ifdef			__SWITCH_SHOW_HEADER
#pragma message ("-- DSWrapLib.h\n")
#endif
#ifdef			__SWITCH_SHOW_HEADER_TREE
#pragma message ("-- "__FILE__"\n")
#endif
#endif 

//
//------------------------------------------------------ FORWARD DECLARATIONS
//

//
//-------------------------------------------------------------- DEPENDENCIES
//

#ifdef			_DSWL_STATIC
#define			_DSWL_EXT_CLASS													
#endif

#ifdef			_DSWL_USE_STATIC
#define			_DSWL_EXT_CLASS													
#endif

#ifdef			_DSWL_DYNAMIC
#define			_DSWL_EXT_CLASS			__declspec( dllexport )
#endif

#ifdef			_DSWL_USE_DYNAMIC
#define			_DSWL_EXT_CLASS			__declspec( dllimport )
#endif

#ifndef			_DSWL_EXT_CLASS
#error			Please specify either _DSWL_USE_DYNAMIC or _DSWL_USE_STATIC before including DSWrapLib.h
#endif

#ifndef			_DSWL_NO_AUTO_LINK
#ifdef			_DSWL_USE_DYNAMIC
	#ifdef			_DEBUG
		#pragma comment	( lib, "DSWrapDllD.lib" )
		#pragma message	( "-- DSWrapLib.h: Auto-linking with DSWrapDllD.lib" )
	#else
		#pragma comment	( lib, "DSWrapDll.lib" )
		#pragma message	( "-- DSWrapLib.h: Auto-linking with DSWrapDll.lib" )
	#endif
#endif

#ifdef			_DSWL_USE_STATIC
	#ifdef			_DEBUG
		#pragma comment	( lib, "DSWrapLibD.lib" )
		#pragma message	( "-- DSWrapLib.h: Auto-linking with DSWrapLibD.lib" )
	#else
		#pragma comment	( lib, "DSWrapLib.lib" )
		#pragma message	( "-- DSWrapLib.h: Auto-linking with DSWrapLib.lib" )
	#endif
#endif
#endif

//
//	-- DEVSTUDIO OBJECT MODEL INTERFACES
//

#ifndef			_DSWL_USE_STATIC
#ifndef			_DSWL_USE_DYNAMIC
#include		<ObjModel/AppGuid.h>																			
#include		<ObjModel/BldGuid.h>																			
#include		<ObjModel/DbgGuid.h>																			
#include		<ObjModel/TextGuid.h>																			

#include		<ObjModel/AppDefs.h>																			
#include		<ObjModel/BldDefs.h>																			
#include		<ObjModel/DbgDefs.h>																			
#include		<ObjModel/TextDefs.h>																			

#include		<ObjModel/AddAuto.h>																			
#include		<ObjModel/AppAuto.h>																			
#include		<ObjModel/BldAuto.h>																			
#include		<ObjModel/DbgAuto.h>																			
#include		<ObjModel/TextAuto.h>																			
#endif
#endif

//
//	-- DEVSTUDIO OBJECT MODEL INTERFACE WRAPPERS
//
#include		"./dswl_application.h"
#include		"./dswl_debugger.h"
#include		"./dswl_windows.h"
#include		"./dswl_documents.h"
#include		"./dswl_projects.h"
#include		"./dswl_configurations.h"
#include		"./dswl_genericwindow.h"
#include		"./dswl_genericdocument.h"
#include		"./dswl_genericproject.h"
#include		"./dswl_configuration.h"
#include		"./dswl_textwindow.h"
#include		"./dswl_textdocument.h"
#include		"./dswl_textselection.h"
#include		"./dswl_texteditor.h"

//
//	-- DEVSTUDIO WRAP LIB MACROS
//
#define			DSWL_RELEASE( a_pInterface ) { if ( NULL != a_pInterface ) a_pInterface->Release(); a_pInterface = NULL; }

				//
				//	DSWL_RELEASE_EX
				//
#ifdef			_DEBUG
#define			DSWL_RELEASE_EX( a_pInterface, Method ) \
				{\
					if ( NULL != a_pInterface )\
					{\
						long lRef = a_pInterface->Release();\
						a_pInterface = NULL;\
						TRACE3( "[DSWrapLib] %-40s: %s->Release() : New RefCount = %d\n", #Method, #a_pInterface, lRef );\
					}\
					else\
					{\
						TRACE2( "[DSWrapLib] %-40s: %s->Release() : Null-Pointer\n", #Method, #a_pInterface );\
					}\
				}
#else
#define			DSWL_RELEASE_EX( a_pInterface, Method ) DSWL_RELEASE( a_pInterface )
#endif

				//
				//	DSWL_VERIFY
				//
#ifdef			_DEBUG

#define			DSWL_VERIFY( Expression )\
				{ \
					HRESULT hResult = (Expression); \
					\
					if ( S_OK != hResult ) \
					{ \
						if ( FAILED( hResult ) ) \
						{ \
							CComBSTR bstrDescription; \
							CComPtr< IErrorInfo > pErrorInfo;\
							if ( ::GetErrorInfo( 0, &pErrorInfo ) == S_OK )\
							{\
								pErrorInfo->GetDescription( &bstrDescription );\
							}\
							_RPTF3( _CRT_ASSERT, "[DSWrapLib] '%s' returned %lx\n\n%S", #Expression, hResult, (BSTR) bstrDescription ); \
						} \
						else \
							_RPTF2( _CRT_ASSERT, "[DSWrapLib] '%s' returned %lx", #Expression, hResult ); \
					} \
				}
#else
#define			DSWL_VERIFY( Expression )	(Expression);
#endif

//
//--------------------------------------------------------- CLASS DECLARATION
//

#endif			// _DSWrapLib_H_INCLUDED
